<template>
	<view class="page content-20 page-bg">
		<block v-if="items.length > 0">
		<view class="item" v-for="item in items" :key='item.id'>
			<view class="item-box">
				<image  class="avatar item-img" :src="item.avatar | avatar" mode=""></image>
				<view class="item-info">
					<view class="title item-title">{{item.nickName}}({{item.varietiesView}})</view>
					<view class="item-desc">{{item.petColor}} | {{item.weight}}kg | {{common.petsSex[item.petSex]}}</view>
				</view>
			</view>
			<view class="limit">
				<view class="limit-com link" @click="$link('/pagesMine/gorowthList')">
					<view class="title theme">成长记录</view>
					<u-icon name='arrow-right' size='20' color='#0bbf68'></u-icon>
				</view>
			</view>
		</view>
		</block>
		<view class="empty" v-else>
			<u-empty mode='list' text='您还没有添加任何成长记录~'></u-empty>
		</view>
	</view>
</template>

<script>
	import common from '../utils/common.js'
	import api from '../utils/api.js'
	export default {
		data() {
			return {
				common,
				items: [],
			}
		},
		
		onLoad() {
			this.getPetList()
		},
		
		methods: {
			getPetList() {
				api.getPetList({ },(res) => {
					 this.items = res
				}) 
			}
		}
	}
</script>

<style scoped lang="scss">
	.item{
		margin-bottom: 20upx;
	}
	.empty{
		margin-top: 100px;
	}
	.item-desc{
		font-size: $font-size-26;
		color: #666666;
		line-height: 26upx;
		margin-top: 10upx;
	}
	.limit{
		margin-top: 20upx;
		padding-top: 20upx;
		border-top: 1px solid $border-color;
		@include flex-base;
		justify-content: center;
	}
	.limit-com{
		font-size: $font-size-26;
		color: #666666;
	}
	.theme{
		color: $theme-color;
		font-weight: bold;
	}
</style>
